package report_log

import (
	"github.com/go-redis/redis"
	"time"
)

func getRds() (*redis.Client, error) {
	options := redis.Options{
		Addr:        "127.0.0.1:16379",
		Password:     "123456",
		DB:           1,
		PoolSize:     4,
		MinIdleConns: 1,
		IdleTimeout:  time.Duration(10) * time.Second,
	}

	client := redis.NewClient(&options)

	_, err := client.Ping().Result()

	return client, err
}

func NewRds() *redis.Client {
	cli, err := getRds()
	if err != nil {
		panic(err.Error())
	}
	return cli
}
